<%@ tag language="java" pageEncoding="UTF-8" body-content="empty" trimDirectiveWhitespaces="true"%>
<%@ attribute name="query" type="java.lang.String" required='true' description="chosen 查询，如：select.chosen-select  #query"%>
<%@ attribute name="lang" required="false" type="java.lang.String" description="界面语言,可选值：'zh_cn'（默认）,'zh_tw','en'" %>
<%@ attribute name="allowSingleDeselect" required="false" type="java.lang.String" description="允许取消单选,可选值：'true'：允许取消,'false'（默认）：不允许" %>
<%@ attribute name="disableSearch" required="false" type="java.lang.String" description="禁用检索,可选值：'true'：禁用,'false'（默认）：不禁用" %>
<%@ attribute name="disableSearchThreshold" required="false" type="java.lang.String" description="当可选选项数目小于或等于此值时，自动禁用检索选项,可选值：数字，默认为0"%>
<%@ attribute name="inheritSelectClasses" required="false" type="java.lang.String" description="继承 &lt;select&gt;的CLASS,可选值：默认为false"%>
<%@ attribute name="maxSelectedOptions" required="false" type="java.lang.String" description="最大选择数目,可选值：数字，默认为Infinity" %>
<%@ attribute name="noResultsText" required="false" type="java.lang.String" description="检索无结果时显示的文本,可选值：字符串，默认从语言配置获取" %>
<%@ attribute name="placeholderText" required="false" type="java.lang.String" description="空值占位文本,可选值：字符串，默认为''" %>
<%@ attribute name="placeholderTextMultiple" required="false" type="java.lang.String" description="多选空值占位文本,可选值：字符串，默认为'placeholderText'值" %>
<%@ attribute name="placeholderTextSingle" required="false" type="java.lang.String" description="单选空值占位文本,可选值：字符串，默认为'placeholderText'值" %>
<%@ attribute name="searchContains" required="false" type="java.lang.String" description="启用任意位置匹配检索,可选值：默认为false"%>
<%@ attribute name="singleBackstrokeDelete" required="false" type="java.lang.String" description="启用退格键删除,可选值：默认为true" %>
<%@ attribute name="width" required="false" type="java.lang.String" description="宽度,可选值：默认为原&lt;select&gt;的宽度" %>
<%@ attribute name="displayDisabledOptions" required="false" type="java.lang.String" description="显示不可选的选项,可选值：默认为true" %>
<%@ attribute name="displaySelectedOptions" required="false" type="java.lang.String" description="显示已选择的选项,可选值：默认为true" %>
<%@ attribute name="dropDirection" required="false" type="java.lang.String" description="选项列表弹出方向,可选值：'auto'（默认)自动决定'down','up'" %>
<script type="text/javascript">
(function(){
	var lang="${lang}"==""?null:"${lang}";
	var allowSingleDeselect="${allowSingleDeselect}"==""?null:"${allowSingleDeselect}"=='true';
	var disableSearch="${disableSearch}"==""?null:"${disableSearch}"=='true';
	var disableSearchThreshold="${disableSearchThreshold}"==""?null:"${disableSearchThreshold}";
	var inheritSelectClasses="${inheritSelectClasses}"==""?null:"${inheritSelectClasses}"=='true';
	var maxSelectedOptions="${maxSelectedOptions}"==""?null:"${maxSelectedOptions}";
	var noResultsText="${noResultsText}"==""?null:"${noResultsText}";
	var placeholderText="${placeholderText}"==""?null:"${placeholderText}";
	var placeholderTextMultiple="${placeholderTextMultiple}"==""?null:"${placeholderTextMultiple}";
	var placeholderTextSingle="${placeholderTextSingle}"==""?null:"${placeholderTextSingle}";
	var searchContains="${searchContains}"==""?null:"${searchContains}"=='true';
	//此处ZUI本身问题，当设置为false时，双击退格键仍可以删除，为true时，delete键无法删除
	var singleBackstrokeDelete="${singleBackstrokeDelete}"==""?null:"${singleBackstrokeDelete}"=='true'; 
	var width="${width}"==""?null:"${width}";
	var displayDisabledOptions="${displayDisabledOptions}"==""?null:"${displayDisabledOptions}"=='true';
	var displaySelectedOptions="${displaySelectedOptions}"==""?null:"${displaySelectedOptions}"=='true';
	var dropDirection="${dropDirection}"==""?null:"${dropDirection}";
	
	var x = {
		'lang':lang,
		'allow_single_deselect':allowSingleDeselect,
		'disable_search':disableSearch,
		'disable_search_threshold':disableSearchThreshold,
		'inherit_select_classes':inheritSelectClasses,
		'max_selected_options':maxSelectedOptions,
		'no_results_text':noResultsText,
		'placeholder_text':placeholderText,
		'placeholder_text_multiple':placeholderTextMultiple,
		'placeholder_text_single':placeholderTextSingle,
		'search_contains':searchContains,
		'single_backstroke_delete':singleBackstrokeDelete,
		'width':width,
		'display_disabled_options':displayDisabledOptions,
		'display_selected_options':displaySelectedOptions,
		'drop_direction':dropDirection
	};
	$('${query}').chosen(x);
})();
</script>
